SPHERE_VEL_AT_T

Overview

Calculate the velocity of a falling sphere after a given time.

Excel Usage

=SPHERE_VEL_AT_T(D, rhop, rho, mu, t, V)
  • D (float, required): Diameter of the sphere [m]
  • rhop (float, required): Particle density [kg/m^3]
  • rho (float, required): Density of the surrounding fluid [kg/m^3]
  • mu (float, required): Viscosity of the surrounding fluid [Pa*s]
  • t (float, required): Time to integrate to [s]
  • V (float, optional, default: 0): Initial velocity of the particle [m/s]

Returns (float): Velocity of falling sphere after time t [m/s], or error message (str) if invalid.

Examples

Example 1: Particle falling in air from rest

Inputs:

D rhop rho mu t V
0.001 2200 1.2 0.0000178 0.5 0

Excel formula:

=SPHERE_VEL_AT_T(0.001, 2200, 1.2, 0.0000178, 0.5, 0)

Expected output:

Result
3.9384

Example 2: Particle with initial velocity

Inputs:

D rhop rho mu t V
0.001 2200 1.2 0.0000178 0.5 30

Excel formula:

=SPHERE_VEL_AT_T(0.001, 2200, 1.2, 0.0000178, 0.5, 30)

Expected output:

Result
9.6865

Example 3: Short integration time

Inputs:

D rhop rho mu t V
0.001 2200 1.2 0.0000178 0.1 0

Excel formula:

=SPHERE_VEL_AT_T(0.001, 2200, 1.2, 0.0000178, 0.1, 0)

Expected output:

Result
0.9586

Example 4: Particle in water

Inputs:

D rhop rho mu t V
0.0001 2600 1000 0.001 0.5 0

Excel formula:

=SPHERE_VEL_AT_T(0.0001, 2600, 1000, 0.001, 0.5, 0)

Expected output:

Result
0.008

Python Code

import micropip
await micropip.install(["fluids"])
from fluids.drag import integrate_drag_sphere as fluids_integrate_drag_sphere

def sphere_vel_at_t(D, rhop, rho, mu, t, V=0):
    """
    Calculate the velocity of a falling sphere after a given time.

    See: https://fluids.readthedocs.io/fluids.drag.html#fluids.drag.integrate_drag_sphere

    This example function is provided as-is without any representation of accuracy.

    Args:
        D (float): Diameter of the sphere [m]
        rhop (float): Particle density [kg/m^3]
        rho (float): Density of the surrounding fluid [kg/m^3]
        mu (float): Viscosity of the surrounding fluid [Pa*s]
        t (float): Time to integrate to [s]
        V (float, optional): Initial velocity of the particle [m/s] Default is 0.

    Returns:
        float: Velocity of falling sphere after time t [m/s], or error message (str) if invalid.
    """
    # Validate inputs
    try:
        D = float(D)
        rhop = float(rhop)
        rho = float(rho)
        mu = float(mu)
        t = float(t)
        V = float(V)
    except (ValueError, TypeError):
        return "Error: All parameters must be numbers."

    if D <= 0:
        return "Error: Diameter must be positive."
    if rhop <= 0:
        return "Error: Particle density must be positive."
    if rho <= 0:
        return "Error: Fluid density must be positive."
    if mu <= 0:
        return "Error: Viscosity must be positive."
    if t < 0:
        return "Error: Time must be non-negative."

    try:
        result = fluids_integrate_drag_sphere(D=D, rhop=rhop, rho=rho, mu=mu, t=t, V=V, distance=False)
        if result != result:  # NaN check
            return "Calculation resulted in NaN."
        return float(result)
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator